package cn.wolfcode.shop.cloud.util;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

public class CookieUtil {

    public static void addCookie(String cookieName, String cookieValue, int expireTime, HttpServletResponse response){
        Cookie cookie = new Cookie(cookieName,cookieValue);
        //作用域
        cookie.setDomain("localhost");
        //生效滤镜
        cookie.setPath("/");
        //过期时间
        cookie.setMaxAge(expireTime);
        response.addCookie(cookie);
    }
}
